﻿@{
    var TID = ViewData["TID"] as int?;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - 移动审批</title>
    <link rel="stylesheet" href="//unpkg.com/layui@2.6.8/dist/css/layui.css" />
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/css/site.css" asp-append-version="true">
    <script src="//unpkg.com/layui@2.6.8/dist/layui.js"></script>
</head>
<body>

    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script src="~/js/site.js" asp-append-version="true"></script>

    <!-- 正文开始 -->
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-body">
                <table class="layui-table layui-form" id="demo" lay-size="sm"></table>
            </div>
        </div>
    </div>
    <!-- js部分 -->
    <script>
        layui.config({
            base: '/assets/js/',
        })

        layui.use(['treeTable','table'], function () {
            var $ = layui.jquery;
            var table = layui.table
                ,treeTable = layui.treeTable;

        $.ajax({
            url: '/api/Approve/SingleTaskNodeTree?taskId=@TID',
            type: 'get',
            async: true,
            dataType: 'json',
            contentType: "application/json",
            success: function (result) {
                // 渲染表格
                treeTable.render({
                    elem: '#demo'
                    ,height: 400
                    ,data: result.data
                    ,title: '流程'
                    ,cols: [{
                        type: 'numbers', 
                        title: '审批步骤',
                        width: '80px',
                        template: function(item){return item.title;}
                    }]
                });
            }
        });

            

            // 渲染表格
            //table.render({
            //    elem: '#demo'
            //    ,height: 400
            //    ,url: "/api/Approve/SingleTaskNodeTree?taskId=@TID"
            //    ,title: '用户表'
            //    ,cols: [[ //表头
            //        {field: 'id', title: '编号', width:80, fixed: 'left'}
            //        ,{ field: 'tx', title: '名称', minWidth: 200 }
            //    ]]
            //});
        });
    </script>

</body>
</html>

